#pragma once
#include "log.h"
#include <iostream>
#include <random>
#include <iomanip>
#include <atomic>
#include <optional>
namespace biteutil
{
    //json序列化和反序列化
    class JSON
    {
    public:
        static std::optional<std::string> serialize(const Json::Value& value, bool styled = false);
        static std::optional<Json::Value> unserialize(const std::string& input); 
    };

    //文件读写操作
    class FUTIL { 
        public:
            static bool read(const std::string &filename, std::string &body);
            static bool write(const std::string &filename, const std::string &body);
    };


    //字符串分割
     class STR {
        public:
            static size_t split(const std::string &src, const std::string &sep, std::vector<std::string> &dst);
    };


    const size_t UUID_SIZE = 16;
    enum UuidType {
        MIX = 0,
        CHAR,
        DIGIT
    };
    class Random {
        public:
            //16个字符长度的字母+数字随机字符串
            static std::string code(size_t len = UUID_SIZE, UuidType utype = UuidType::MIX);
            //生成一个指定区间的随机数
            static size_t number(size_t min, size_t max);
    };
}